<?php

namespace app\common\controller;

use think\Controller;
use think\Request;
use think\auth\Auth;

class Base extends Controller
{
    function _initialize()
    {
        cookie('admin') && (session('adminInfo') || session('adminInfo',cookie('admin')));
        session('adminInfo') || $this->error('非法进入!');

        $ruleName = request()->module().'/'.request()->controller().'/'.request()->action();
        $auth = new Auth();
        if(!$auth->check($ruleName,session('adminInfo.aid')) && session('adminInfo.aid') != 2){
            $this->error('您没有权限!');
        }
    }

}
